<?php
/**
 * Created by PhpStorm.
 * Date: 2020/4/26
 */

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class UserIsLogin
{
    /**
     * Handle an incoming request.
     *
     * @param \Illuminate\Http\Request $request
     * @param \Closure $next
     * @return mixed
     */
    public function handle(Request $request, Closure $next)
    {
        //用户是否登录
        if (!Auth::guard('web')->check()) {
            return redirect('/login');
        }

        return $next($request);
    }
}